package com.Maykk.Demo03;

import com.Maykk.Demo02.KeyBoard;
import com.Maykk.Demo02.Mouse;
import com.Maykk.Demo02.USB;

public class Computer {
    public void on() {
        System.out.println("电脑开机了~");
    }

    public void off() {
        System.out.println("电脑关机了");
    }

    public void useDevice(USB dev) {
        if (dev instanceof com.Maykk.Demo02.Mouse) {
            ((Mouse) dev).on();
            ((Mouse) dev).leftClick();
            ((Mouse) dev).doubleClick();
            ((Mouse) dev).rightClick();
            ((Mouse) dev).off();
        } else if (dev instanceof com.Maykk.Demo02.KeyBoard) {
            ((KeyBoard) dev).on();
            ((KeyBoard) dev).inputting();
            ((KeyBoard) dev).off();
        }
    }
}